package org.tongdao.yulong.event;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;

/**
 * @Description: TODO
 * @author: 殷玉龙
 * @date: 2021年01月20日 下午2:03
 */
@Service
public class RegisterService implements ApplicationEventPublisherAware {
  ApplicationEventPublisher publisher;
  public void register(String username) {
    // 用户注册的动作。。。
    System.out.println(username + "注册成功。。。");
    // 发布事件
    publisher.publishEvent(new RegisterSuccessEvent(username));
  }

  @Override
  public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
    this.publisher = applicationEventPublisher;
  }
}
